package m3_workqueue;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.MessageProperties;

import java.io.IOException;
import java.util.Scanner;
import java.util.concurrent.TimeoutException;

public class Producer {

    public static void main(String[] args) throws IOException, TimeoutException {
        ConnectionFactory f=new ConnectionFactory();
        f.setHost("192.168.64.140");
        f.setUsername("admin");
        f.setPassword("admin");
        Channel c=f.newConnection().createChannel();

        c.exchangeDeclare("logs", BuiltinExchangeType.FANOUT.getType());

        while(true){
            System.out.println("输入消息:");
            String msg=new Scanner(System.in).nextLine();
            c.basicPublish("logs","", null,msg.getBytes());




        }
    }

}
